home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 145
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan).7z
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan) (Track 1).bin
/
tools
/
sharp
/
sxwork3.lzh
/
サンプル実用編
/
小遣い帳
/
CASH.H
< prev
next >
Wrap
Text File
|
1994-03-10
|
6KB
|
208 lines
/******************************************************************************
* cash.h: 小遣い帳用ヘッダファイル
******************************************************************************
* Workroom SX-68K Sample Program Copyright 1994 SHARP
*
* 定数定義
*/
/* ウィンドウタイトル */
#define WINTITLE ((_LASCII) "\x08小遣い帳")
/* ウィンドウサイズ */
#define WIN_H 350 /* ウィンドウの幅 */
#define WIN_V 240 /* ウィンドウの高さ */
/* 数値調整ボタンのリピート時間(1/100秒単位)*/
#define ADJFIRST 40 /* リピート開始時間 */
#define ADJNEXT 16 /* リピート間隔 */
#define CELLMG 3 /* セルとレクタングルの間のマージン */
#define OUTFRM 8 /* 外枠と内枠のマージン */
#define CELLPTX 20 /* 表の表示開始位置 */
#define CELLPTY 30
#define ESE_X 18 /* 疑似ダイアログの表示開始位置 */
#define ESE_Y 18
#define BTNY (CELLPTY - 22) /* 数値調整ボタンの位置 */
#define BTNX (CELLPTX + 171)
/* イベントマスク */
#define EVENTMASK (EM_IDLE | EM_MSLDOWN | EM_MSRDOWN | EM_UPDATE | EM_ACTIVATE | EM_SYSTEM1 | EM_SYSTEM2)
/*
* 構造体宣言
*/
typedef struct EseDlg {
Window *windowPtr;
TEdit **tEdit;
BOOLEAN visible;
char **title;
int tmode; /* 編集テキストのモード */
Point ttlPos;
Point ttlPos2[2];
Rect rcFrame; /* 外枠のレクタングル */
Rect rcText[2];
Rect rcPart; /* 文字ボタンのパーティション */
/* テキストのディスティネーションレクタングル */
Rect rcDest;
Control **execBtnHdl; /* 実行 */
Control **canBtnHdl; /* 取消 */
int value[2];
char tBuff[2][10]; /* 編集テキストの待避バッファ */
} EseDlg;
typedef struct CAtt { /* セル一列の属性を示す */
short array; /* 使用する配列番号 */
/* データ属性 0 = 数値、1 = 文字列、2 = タイトル */
short attrib;
short size; /* セル1要素のバイト数 */
int length; /* セルの文字数 */
} CAtt;
typedef struct CPoint {
int x;
int y;
} CPoint;
typedef struct Mtx {
Point pos; /* 表示開始座標 */
Point offset; /* データセルへのオフセット */
Rect rcAll; /* 全体を示すレクタングル */
CPoint eCell; /* 編集セルの位置 */
CPoint mCell; /* 確定されたセル位置 */
int focus; /* 編集領域フラグ */
BOOLEAN edit; /* 編集フラグ */
TEdit **tEdit; /* テキストエディットハンドル */
short fontSize; /* フォントサイズ (6, 8, 12) */
short cWide; /* セルの横の個数 */
short cHeight; /* セルの縦の個数 */
CAtt *cAttH; /* セルの属性の配列へのポインタ(横)*/
/* タイトルの配列へのポインタ(横)(縦)*/
char ***cTitle;
char **cData; /* データの配列を格納するポインタ */
} Mtx;
typedef struct ComVal { /* 共通変数 */
Window *windowPtr; /* ウィンドウポインタ */
BOOLEAN activeFlag; /* アクティブフラグ */
TsEvent event; /* イベントレコード */
int eventMask; /* イベントマスク */
int errorCode; /* エラーコード */
BOOLEAN endFlag; /* 終了フラグ */
int month; /* 編集対象の日付 */
int day;
int thisMonth; /* 今日の日付 */
int today;
Control **adjBtnHdl; /* 数値調整ボタン */
/* 疑似ダイアログ用ワーク */
BOOLEAN eseFlag;
EseDlg eseDlg;
/* 小遣い入力表用ワーク */
BOOLEAN editFlag; /* 表の編集フラグ */
int keMode; /* 表の表示モード */
Mtx cashTbl; /* 表作成用構造体 */
char **keTitle[2]; /* 表のタイトルを示すテーブル */
char *keData[2]; /* 表のデータを示すテーブル */
/* 過去3ヶ月合計表示用ワーク */
char **k3Title[2]; /* 表のタイトルを示すテーブル */
char *k3Data[4]; /* 表のデータを示すテーブル */
char *ke3Til[5]; /* 横の項目タイトル */
char ke3STil[3][12]; /* タイトル作成用ワーク */
/* データ格納用配列 */
int money[8]; /* 金額データ */
int money1[8];
int money2[8];
int money3[8];
char info[8][21]; /* 摘要データ */
char dataFile[100]; /* データファイル名 */
} ComVal;
/*
* 外部変数宣言
*/
extern short funcKeyTbl[]; /* ファンクションキーアサインテーブル */
/*
* 関数プロトタイプ
*/
/* csmain.c */
BOOLEAN init(ComVal *);
BOOLEAN createWindow(ComVal *);
BOOLEAN createControl(ComVal *);
void idleEvent(ComVal *);
void msLDownEvent(ComVal *);
void checkControl(ComVal *);
void msRDownEvent(ComVal *);
void selectMenu(ComVal *);
void keyDownEvent(ComVal *);
void updateEvent(ComVal *);
void drawGraph(ComVal *);
void activateEvent(ComVal *);
void systemEvent(ComVal *);
void showErrDialog(ComVal *);
void endProc(int, ComVal *);
void repeatAdjBtn(ComVal *, int, int *, int *);
void addUpdate(Window *, Rect *);
/* cash.c */
BOOLEAN initCashTbl(ComVal *);
BOOLEAN initCash3M(ComVal *);
void getTomorrow(int, int, int *, int *);
void getYesterday(int, int, int *, int *);
BOOLEAN checkDate(int, int);
int getMaxDay(int);
void clearData(int *, char *);
BOOLEAN sumMonth(ComVal *, int, int *, char *);
BOOLEAN get3Month(ComVal *, int);
void execDlg(ComVal *, int);
void reloadData(ComVal *, int, int);
void postEvent(ComVal *);
/* csfile.c */
BOOLEAN loadFile(ComVal *, int, int, int *, char *);
BOOLEAN newFile(ComVal *);
BOOLEAN readTable(ComVal *, short *);
BOOLEAN saveFile(ComVal *, int, int, int *, char *);
void errSaveFile(FILE *, int);
int checkDrive(char *, int);
/* csese.c */
BOOLEAN openEseDlg(EseDlg *, Window *, char *);
void closeEseDlg(EseDlg *);
void drawEseDlg(EseDlg *);
void showEseDlg(EseDlg *);
void hideEseDlg(EseDlg *);
BOOLEAN createEseText(EseDlg *);
BOOLEAN createEseControl(EseDlg *);
void caretEseDlg(EseDlg *, BOOLEAN);
int eseDlgEvent(EseDlg *, TsEvent *);
int getEseVal(EseDlg *, int *, int);
int setEseVal(EseDlg *, int, int);
void moveEdit(EseDlg *, int );
void setClip(Window *, Rect *);
void releaseClip(Window *);
/* cscell.c */
BOOLEAN openCell(Mtx *, Window *, LPoint, int, int, int);
void closeCell(Mtx *, Window *);
void setCellData(Mtx *, CAtt *, char **, char ***);
void drawCell(Mtx *);
void drawCellOne(Mtx *, CPoint *);
void drawCellStr(Mtx *, Rect *, CPoint *);
void drawCellFrame(Rect *, short, short);
LPoint cptToLpt(Mtx *, CPoint *);
void focusOn(Mtx *, CPoint *);
void focusOff(Mtx *);
void drawFocus(Mtx *);
void mountFocus(Mtx *);
int cellEvent(Mtx *, TsEvent *);
void nextCell(Mtx *, CPoint *, CPoint *);
BOOLEAN checkCpt(Mtx *, LPoint, CPoint *);
BOOLEAN totalCell(Mtx *, int);
void caretCell(Mtx *, int);
void clearCell(Mtx *, Window *);